package com.yu.yupicture.common;

import com.yu.yupicture.exception.ErrorCode;
import lombok.Data;

import java.io.PrintStream;
import java.io.Serializable;
import java.util.concurrent.Semaphore;

@Data
public class BaseReponse<T> implements  Serializable {

    private int code;
    private  T data;
    private String message;

    public BaseReponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }


    public BaseReponse(ErrorCode errorCode,String  message) {
        this.code = errorCode.getCode();
        this.data = null;
        this.message = message;
    }

    public BaseReponse(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.data = null;
        this.message = errorCode.getMessage();
    }

    public BaseReponse(int code, String message) {
        this.code = code;
        this.data = null;
        this.message = message;
    }
}
